<template>
	<view>
		<zmm-watermark :watermark="userStore.watermark" v-if="userStore.watermark"></zmm-watermark>
		<view class="content detail">
			<!--个人营销预算-->
			<view class="detail-item">
				<uni-section title="个人营销预算" type="line"></uni-section>
				<view class="detail-content">
					<view class="detail-text">姓名：<text>{{info.nickName}}</text></view>
					<view class="detail-text">预算年月：<text>{{info.planMonth}}</text></view>
					<view class="detail-text">区域：<text>{{arrText(setStore.allProvinceList, info.regionCode)}}</text></view>
					<view class="detail-text">预算金额：<text>{{info.totalAmount}}</text></view>
					<view class="detail-text">已用金额：<text>{{info.usedAmount}}</text></view>
					<view class="detail-text">过期金额：<text>{{info.overdueAmount}}</text></view>
					<view class="detail-text">预算剩余：<text>{{info.totalBalance}}</text></view>
					<view class="detail-text">可用金额：<text>{{info.usableAmount}}</text></view>
					<view class="detail-text">备注：<text>{{info.remark}}</text></view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { computed, onMounted, ref } from 'vue';
import { tab, auth, modal } from "@/plugins"
import { getTitle } from "@/utils/getter"
import { checkPermi, checkRole, checkOnlyPermi, checkOnlyRole } from "@/utils/permission"
import { marketPlanDetail } from "@/api/erp_api/coupon"
import { copyText, arrText, previewImg } from '@/utils/ty.js';
import { marketPlanStatusList } from '@/utils/config.js'
import useUserStore from '@/store/modules/user'
import useSetStore from '@/store/modules/set';

	const userStore = useUserStore()
	const setStore = useSetStore()
	onLoad((option) => {
		if (option.id) {
			id.value = option.id
			getDetail()
		}
	})
	
	// 数据查询
	const id = ref('')
	const info = ref({})
	const isLoading = ref(false)
	
	const getDetail = () => {
		const params = {
			id: id.value
		}
		isLoading.value = true
		uni.showLoading({
			title: '数据加载中...'
		})
		marketPlanDetail(params).then(res => {
			info.value = res.data || {}
			isLoading.value = false
			uni.hideLoading()
    }).catch(() => {
			isLoading.value = false
			uni.hideLoading()
		})
	}
	
</script>

<style scoped lang="scss">
	.detail-text-copy {
		margin-left: 0;
		margin-right: 10px;
	}
</style>
